import Vue from 'vue';
import Vuex from 'vuex';
import {
	getResourceList
} from '@/api/data/tbNetDisk';
Vue.use(Vuex)
const state = {
	curLibFolder: []
}
const actions = {
	//获取当前库文件夹
	async getCurLibFolder({
		commit
	}, dirId) {
		let params = {
			page: 1,
			limit: 9999,
			pid: '0',
			isFolder: '1',
			dirId
		};
		let result = await getResourceList(params).then(res => res.data);
		if (result.code == '0') {
			console.log();
			commit('CUR_LIB_FOLDER', result.data || []);
		} else {
			Promise.reject(new Error('faile'));
		}
	}
}
const mutations = {
	CUR_LIB_FOLDER: (state, d) => {
		state.curLibFolder = d;
	},
}
export default {
	state,
	actions,
	mutations
}